package com.lvbaoins.creditapp.util;

import cn.hutool.core.util.RandomUtil;

public class UserTokenManager {

    public static String generateToken(Integer id) {
        JwtHelper jwtHelper = new JwtHelper();
        return jwtHelper.createToken(id);
    }
    public static Integer getUserId(String token) {
        JwtHelper jwtHelper = new JwtHelper();
        Integer userId = jwtHelper.verifyTokenAndGetUserId(token);
        if(userId == null || userId == 0){
            return null;
        }
        return userId;
    }

    public static void main(String[] args) {
        System.out.printf(RandomUtil.randomString(30) + "." + QRCodeUtil.FORMAT_NAME);
    }
}
